﻿using System;
using System.Collections.Generic;

namespace Keyki.NefClass.Kernel.Data
{
	internal sealed class Species
	{
		private readonly List<String> names;

		public Species()
		{
			names = new List<string>();
		}//Species

		public string this[int index]
		{
			get
			{
				if (index >= names.Count)
					throw new IndexOutOfRangeException("No such class");
				
				return names[index];
			}//get
		}//this[int]

		public int Count
		{
			get { return names.Count; }
		}//Count

		public int Add(string name)
		{
			if (names.IndexOf(name) < 0)
				names.Add(name);

			return names.IndexOf(name);
		}//Add

		public void Remove(string name)
		{
			names.Remove(name);
		}//Remove

		public int IndexOf(string name)
		{
			return Add(name);
		}//IndexOf
	}//Species
}//Keyki.NefClass.Kernel.Classes